using System;
using System.BusinessObjects.Data;
using System.BusinessObjects.Providers;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace Blazing.UI.Cms.Admin
{
    public class Global : System.Web.HttpApplication
    {
        public override void Init()
        {
            base.Init();

            EndRequest += Global_EndRequest;
            BeginRequest += Global_BeginRequest;
        }

        void Application_Start(object sender, EventArgs e)
        {
            log4net.Config.XmlConfigurator.Configure();
        }


        void Global_BeginRequest(object sender, EventArgs e)
        {
            
            ((NHibernateAspContextProvider)NHibernateSessionProvider.Provider).BindNewSession();
        }

        static void Global_EndRequest(object sender, EventArgs e)
        {
            NHibernateSessionProvider.Provider.CloseSession();
        }

    }
}